<include file="public@head" />
</head>

<body>
    <div class="layui-fluid wrap js-check-wrap" id="component-tabs">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">资源管理</div>
                    <div class="layui-card-body">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li class="layui-this"><a href="{:url('AdminAsset/index')}">资源列表</a></li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <php>$status=['不可用', '可用'];</php>
                                    <table class="layui-table">
                                        <colgroup>
                                            <col width="35">
                                            <col width="260">
                                            <col>
                                            <col>
                                            <col width="260">
                                            <col width="30">
                                            <col width="220">
                                        </colgroup>
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>用户ID</th>
                                                <th>文件大小</th>
                                                <th>文件名</th>
                                                <th>图像</th>
                                                <th>文件路径</th>
                                                <th>状态</th>
                                                <th>{:lang('ACTIONS')}</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <php>
                                                $asset_img_suffixes=['bmp','jpg','jpeg','png','gif','tiff'];/*TODO ADD MORE*/
                                            </php>
                                            <foreach name="assets" item="vo">
                                                <tr>
                                                    <td>{$vo.id}</td>
                                                    <td>
                                                        {$vo.user_id}-{$vo.user_login}-{$vo.user_nickname}
                                                    </td>
                                                    <td>{$vo.file_size/1024|round}KB</td>
                                                    <td>{$vo.filename}</td>
                                                    <td>
                                                        <if condition="in_array(strtolower($vo['suffix']),$asset_img_suffixes)">
                                                            <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo['file_path'])}');">
                                                                <i class="fa fa-photo fa-fw"></i>
                                                            </a>
                                                        </if>
                                                    </td>
                                                    <td>
                                                        {$vo.file_path}
                                                        <if condition="!file_exists('upload/'.$vo['file_path'])">
                                                            <span style='color:red;'>&nbsp;&nbsp(文件丢失)</span>
                                                        </if>
                                                    </td>
                                                    <td><span class="layui-btn layui-btn-xs layui-btn-warm">{$status[$vo['status']]}</span></td>
                                                    <td>
                                                        <a href="{:url('AdminAsset/delete',array('id'=>$vo['id']))}" class="layui-btn layui-btn-xs layui-btn-danger js-ajax-delete">{:lang('DELETE')}</a>
                                                    </td>
                                                </tr>
                                            </foreach>
                                        </tbody>
                                    </table>
                                    <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1">
                                        <span class="layui-laypage-count">共 100 条</span>
                                        {$page|default=''}
                                        <span class="layui-laypage-limits">
                                            <select lay-ignore="">
                                                <option value="10" selected="">10 条/页</option>
                                                <option value="20">20 条/页</option>
                                                <option value="30">30 条/页</option>
                                                <option value="40">40 条/页</option>
                                                <option value="50">50 条/页</option>
                                            </select>
                                        </span>
                                        <span class="layui-laypage-skip">到第<input type="text" min="1" value="1" class="layui-input" id="page">页
                                            <a href="{:url('user/AdminAsset/index',['page'=>2])}" type="button" class="layui-laypage-btn">确定</a>
                                            <!-- <a class="js-ajax-dialog-btn" data-msg="确定还原吗？">还原</a> -->
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <include file="public@footer" />
    <script>
    layui.use('form', function() {
        var form = layui.form,
            $ = layui.$;
        $('a.layui-laypage-btn').on('click', function() {
            // alert($('input#page').val());
            console.log('{$Request.url}');
            // $(this).attr('href');
        });
    });
    </script>
</body>

</html>